package org.example.springioc01.service;

import lombok.Getter;
import lombok.ToString;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.NamedBean;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;



//感知接口
@Getter
@ToString
@Service
public class HahaService implements EnvironmentAware, BeanNameAware {
    String myName;
    Environment environment;
    @Override
    public void setEnvironment(Environment environment) { //environment 自动注入
        this.environment = environment;
    }
    public String getOsType(){
        String type = environment.getProperty("OS");
        return type;
    }

    @Override
    public void setBeanName(String name) {  //name自动注入
        this.myName = name;
    }
}
